package com.kudostar.android.kudostar;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.Menu.Item;

/**
 * @author Mike Luby
 * 
 */
public class KudoStar extends Activity {
	/**
	 * Common KudoStar calls
	 */
	KudoCommon kc = new KudoCommon( );
	
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate( icicle );
		// Set Content
		setContentView( R.layout.main );
		
		/**
		 * ListButton Listeners
		 */
		findViewById( R.id.view_list ).setOnClickListener( new View.OnClickListener( ) {
			public void onClick(View view) {
				/**
				 * Show Client's KudoStars in list format
				 */
				startActivity( new Intent( KudoStar.this, KudoList.class ) );
			}
		} );
		/**
		 * FriendButton Listeners
		 */
		findViewById( R.id.view_friends ).setOnClickListener( new View.OnClickListener( ) {
			public void onClick(View view) {
				/**
				 * Show Submit Form
				 */
				startActivity( new Intent( KudoStar.this, KudoFriendList.class ) );
			}
		} );
		/**
		 * SubmitButton Listeners
		 */
		findViewById( R.id.view_submit ).setOnClickListener( new View.OnClickListener( ) {
			public void onClick(View view) {
				/**
				 * Show Submit Form
				 */
				startActivity( new Intent( KudoStar.this, SubmitKudo.class ) );
			}
		} );
		/**
		 * SettingButton Listeners
		 */
		findViewById( R.id.view_settings ).setOnClickListener( new View.OnClickListener( ) {
			public void onClick(View view) {
				/**
				 * Show Settings form
				 */
				startActivity( new Intent( KudoStar.this, KudoPref.class ) );
			}
		} );
	}

	/**
	 * Build Menu Can wait for OptionSelected Call
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu( menu );
		return this.kc.BuildMenu( menu );
	}

	@Override
	public boolean onOptionsItemSelected(Item item) {
		return this.kc.MenuOptionSelect( this, item );
	}
}